{% extends "base.html" %}
{% block page_title %}文档下载{% endblock %}

{% block page_css %}
<link href="{{ url_for('static',filename='css/list_detail.css') }}" rel="stylesheet">
{% endblock %}

{% block page_content %}
    <div class="container">
        <h2>文档列表</h2>

        <div class="list-group">
        {% for d in docList %}
            <li class="list-group-item"><span class="glyphicon glyphicon-folder-open"></span>
            {{ d }}
            <a href="{{ url_for('main.downloadDoc',fileName=d) }}"><button class="btn btn-info pull-right">下载</button></a>
            {% if current_user.isAdmin() %}
            <a href="{{ url_for('main.deleteDoc',filename=d) }}"><button class="btn btn-info pull-right">删除</button></a>
            {% endif %}
            </li>
        {% endfor %}
        </div>

        <!-- 上传任务 -->
        {% if form %}
        <div>
        <form action="/uploadDoc" method="post" class="form" enctype="multipart/form-data" role="form">
            {{ form.csrf_token }}
            <input id="file" name="file" required type="file" class="input_file">      
            <input class="btn btn-info pull-left" id="submit" name="submit" type="submit" value="上传">
        </form>
        </div>
        {% endif %}
    </div>
{% endblock %}